<?php
$module_type = $sf_context->getModuleName();
$module = $sf_context->getRouting()->getCurrentRouteName();
$moduleName = "";
$breadcrumb = array();
$bread_link = array();
$bread_link['name'] = "";
$bread_link['link'] = "";
//var_dump($module);

switch ($module) {
    case "account_edit":
        if ($moduleName == "")
            $moduleName = "Sửa Account";
        $bread_link['name'] = $moduleName;
        $bread_link['link'] = url_for("@account_edit");
        $breadcrumb[] = $bread_link;
    case "account_list":
        if ($moduleName == "")
            $moduleName = "Danh sách Account";
        $bread_link['name'] = "Danh sách Account";
        $bread_link['link'] = url_for("@account_list");
        $breadcrumb[] = $bread_link;
    case "jobboard_list":
        if ($moduleName == "")
            $moduleName = "Quản lý website";
        $bread_link['name'] = "Quản lý website";
        $bread_link['link'] = url_for("@jobboard_list");
        $breadcrumb[] = $bread_link;
        break;
    case "sf_guard_user":
		if ($moduleName == "")
	        $moduleName = "Quản lý Người dùng";
		$bread_link['name'] = "Quản lý Người dùng";
		$bread_link['link'] = url_for("@sf_guard_user");
		$breadcrumb[] = $bread_link;
        break;
    case "marque_list":
        if ($moduleName == "")
            $moduleName = "Quản lý thương hiệu";
        $bread_link['name'] = $moduleName;
        $bread_link['link'] = url_for("@marque_list");
        $breadcrumb[] = $bread_link;
        break;
	case "category_list":
        if ($moduleName == "")
            $moduleName = "Quản lý Hạng mục";
        $bread_link['name'] = $moduleName;
        $bread_link['link'] = url_for("@category_list");
        $breadcrumb[] = $bread_link;
        break;
	case "slot_list":
        if ($moduleName == "")
            $moduleName = "Quản lý Slot";
        $bread_link['name'] = $moduleName;
        $bread_link['link'] = url_for("@slot_list");
        $breadcrumb[] = $bread_link;
        break;
	case "cms_edit":
		if ($moduleName == "")
	        $moduleName = "Chỉnh sửa Tin tức";
		$bread_link['name'] = "Chỉnh sửa Tin tức";
		$bread_link['link'] = url_for("cms_edit");
		$breadcrumb[] = $bread_link;
	case "cms_list":
		if ($moduleName == "")
	        $moduleName = "Danh sách Tin tức";
		$bread_link['name'] = "Danh sách Tin tức";
		$bread_link['link'] = url_for("cms_list");
		$breadcrumb[] = $bread_link;
	case "cms_category_edit":
		if (($bread_link['name']) || $bread_link['name'] != "Danh sách Tin tức") {
			if ($moduleName == "")
				$moduleName = "Chỉnh sửa Danh mục";
			$bread_link['name'] = "Chỉnh sửa Danh mục";
			$bread_link['link'] = url_for("cms_category_edit");
			$breadcrumb[] = $bread_link;
		}
	case "cms_category_list":
		if ($moduleName == "")
	        $moduleName = "Danh mục Tin tức";
		$bread_link['name'] = "Danh mục Tin tức";
		$bread_link['link'] = url_for("cms_category_list");
		$breadcrumb[] = $bread_link;
        break;	
    case "default":
		if ($moduleName == "")
	        $moduleName = "Dashboard";
        break;
}
$bread_link['name'] = "Dashboard";
$bread_link['link'] = url_for("default");
$breadcrumb[] = $bread_link;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>    
	<?php include_http_metas() ?>
    <?php include_metas() ?>
    <?php include_title() ?>
    <link rel="shortcut icon" href="/favicon.ico" />
    <?php include_stylesheets() ?>
    <?php include_javascripts() ?>
    <script type="text/javascript" src="/js/jquery/jquery.min.js"></script>
	<script type="text/javascript" src="/js/bootstrap/bootstrap.js"></script>
    <script type="text/javascript" src="/js/jquery.cookie.js"></script>
    <script type="text/javascript" src="/js/jquery.mousewheel.js"></script>
    <script type="text/javascript" src="/js/plugins/qtip/jquery.qtip.min.js"></script>
    <script type="text/javascript" src="/js/plugins/flot/jquery.flot.js"></script>
    <script type="text/javascript" src="/js/plugins/flot/jquery.flot.grow.js"></script>
    <script type="text/javascript" src="/js/plugins/flot/jquery.flot.pie.js"></script>
    <script type="text/javascript" src="/js/plugins/flot/jquery.flot.resize.js"></script>
    <script type="text/javascript" src="/js/plugins/flot/jquery.flot.tooltip_0.4.4.js"></script>
    <script type="text/javascript" src="/js/plugins/flot/jquery.flot.orderBars.js"></script>
    <script type="text/javascript" src="/js/plugins/sparkline/jquery.sparkline.min.js"></script>
    <script type="text/javascript" src="/js/plugins/knob/jquery.knob.js"></script>
    <script type="text/javascript" src="/js/plugins/fullcalendar/fullcalendar.min.js"></script>
    <script type="text/javascript" src="/js/plugins/prettify/prettify.js"></script>
    <script type="text/javascript" src="/js/plugins/watermark/jquery.watermark.min.js"></script>
    <script type="text/javascript" src="/js/plugins/elastic/jquery.elastic.js"></script>
    <script type="text/javascript" src="/js/plugins/inputlimiter/jquery.inputlimiter.1.3.min.js"></script>
    <script type="text/javascript" src="/js/plugins/maskedinput/jquery.maskedinput-1.3.min.js"></script>
    <script type="text/javascript" src="/js/plugins/ibutton/jquery.ibutton.min.js"></script>
    <script type="text/javascript" src="/js/plugins/uniform/jquery.uniform.min.js"></script>
    <script type="text/javascript" src="/js/plugins/stepper/ui.stepper.js"></script>
    <script type="text/javascript" src="/js/plugins/color-picker/colorpicker.js"></script>
    <script type="text/javascript" src="/js/plugins/timeentry/jquery.timeentry.min.js"></script>
    <script type="text/javascript" src="/js/plugins/select/select2.min.js"></script>
    <script type="text/javascript" src="/js/plugins/dualselect/jquery.dualListBox-1.3.min.js"></script>
    <script type="text/javascript" src="/js/plugins/tiny_mce/jquery.tinymce.js"></script>
    <script type="text/javascript" src="/js/plugins/validate/jquery.validate.min.js"></script>
    <script type="text/javascript" src="/js/plugins/search/tipuesearch_set.js"></script>
    <script type="text/javascript" src="/js/plugins/search/tipuesearch_data.js"></script>
    <script type="text/javascript" src="/js/plugins/search/tipuesearch.js"></script>
    <script type="text/javascript" src="/js/plugins/animated-progress-bar/jquery.progressbar.js"></script>
    <script type="text/javascript" src="/js/plugins/pnotify/jquery.pnotify.min.js"></script>
    <script type="text/javascript" src="/js/plugins/lazy-load/jquery.lazyload.min.js"></script>
    <script type="text/javascript" src="/js/plugins/jpages/jPages.min.js"></script>
    <script type="text/javascript" src="/js/plugins/pretty-photo/jquery.prettyPhoto.js"></script>
    <script type="text/javascript" src="/js/plugins/smartWizzard/jquery.smartWizard-2.0.min.js"></script>
    <script type="text/javascript" src="/js/plugins/ios-fix/ios-orientationchange-fix.js"></script>
    <script type="text/javascript" src="/js/plugins/dataTables/jquery.dataTables.min.js"></script>
    <script type="text/javascript" src="/js/plugins/elfinder/elfinder.min.js"></script>
    <script type="text/javascript" src="/js/plugins/plupload/plupload.js"></script>
    <script type="text/javascript" src="/js/plugins/plupload/plupload.html4.js"></script>
    <script type="text/javascript" src="/js/plugins/plupload/jquery.plupload.queue/jquery.plupload.queue.js"></script>
    <script type="text/javascript" src="/js/jquery/jquery-ui.min.js"></script>
    <script type="text/javascript" src="/js/plugins/touch-punch/jquery.ui.touch-punch.min.js"></script>
    <script type="text/javascript" src="/js/plugins/responsive-tables/responsive-tables.js"></script>
    <script type="text/javascript" src="/js/statistic.js"></script>
    <script type="text/javascript" src="/js/main.js"></script>
    <!-- Mobile Specific Metas -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <!-- Use new way for google web fonts 
    http://www.smashingmagazine.com/2012/07/11/avoiding-faux-weights-styles-google-web-fonts -->
    <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css' /> <!-- Headings -->
    <link href='http://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css' /> <!-- Text -->
    <!--[if lt IE 9]>
    <link href="http://fonts.googleapis.com/css?family=Open+Sans:400" rel="stylesheet" type="text/css" />
    <link href="http://fonts.googleapis.com/css?family=Open+Sans:700" rel="stylesheet" type="text/css" />
    <link href="http://fonts.googleapis.com/css?family=Droid+Sans:400" rel="stylesheet" type="text/css" />
    <link href="http://fonts.googleapis.com/css?family=Droid+Sans:700" rel="stylesheet" type="text/css" />
    <![endif]-->
    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <!--[if lt IE 9]>
        <link type="text/css" href="css/ie.css" rel="stylesheet" />
    <![endif]-->
</head>
<body class="<?php echo ($module_type == 'sfGuardAuth')?"loginPage":"" ?>">
	<?php
    $sf_context->getUser()->setCulture('vi');
    
    if ($module_type == 'sfGuardAuth') {
	    echo $sf_content;
    }
    else {
  	?>
	<script type="text/javascript">
        //adding load class to body and hide page
        document.documentElement.className += 'loadstate';
		
		function sign_out()
		{
			$.ajax({
			  type: "POST",
			  url: "<?php echo url_for('@default_logout') ?>",
			  data: { is_log_out: 'yes' },
			  success: function(data) {
				alert('Đăng xuất thành công');
				window.location = "<?php echo url_for('@default') ?>";
			  }
			});
		}
    </script>
    
    <!-- loading animation -->
    <div id="qLoverlay"></div>
    <div id="qLbar"></div>
    
    <div id="header">
        <div class="navbar">
            <div class="navbar-inner">
              <div class="container-fluid">
                <a class="brand" href="<? echo url_for('default')?>">VTNS <span class="slogan">admin</span></a>
                <div class="nav-no-collapse">
                    <ul class="nav">
                        <li class="active"><a href="<? echo url_for('default')?>"><span class="icon16 icomoon-icon-screen"></span> Dashboard</a></li>
                    </ul>
                  
                    <ul class="nav pull-right usernav">
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle avatar" data-toggle="dropdown">
                                <span class="txt"><? echo $sf_user->getGuardUser()->first_name." ".$sf_user->getGuardUser()->last_name; ?></span>
                                <b class="caret"></b>
                            </a>
                            <ul class="dropdown-menu">
                                <li class="menu">
                                    <ul>
                                        <li>
                                            <a href="<?php echo url_for('sf_guard_user') ?>"><span class="icon16 icomoon-icon-user-3"></span>Edit profile</a>
                                        </li>
                                        <li>
                                            <a href="#"><span class="icon16 icomoon-icon-comments-2"></span>Approve comments</a>
                                        </li>
                                        <li>
                                            <a href="#"><span class="icon16 entypo-icon-contact"></span>Add user</a>
                                        </li>
                                    </ul>
                                </li>
                            </ul>
                        </li>
                        <li><a href="#" onclick="sign_out()" ><span class="icon16 icomoon-icon-exit"></span> Logout</a></li>
                    </ul>
                </div><!-- /.nav-collapse -->
              </div>
            </div><!-- /navbar-inner -->
          </div><!-- /navbar --> 

    </div><!-- End #header -->

    <div id="wrapper">

        <!--Responsive navigation button-->  
        <div class="resBtn">
            <a href="#"><span class="icon16 minia-icon-list-3"></span></a>
        </div>
        
        <!--Sidebar collapse button-->  
        <div class="collapseBtn">
             <a href="#" class="tipR" title="Hide sidebar"><span class="icon12 minia-icon-layout"></span></a>
        </div>

        <!--Sidebar background-->
        <div id="sidebarbg"></div>
        <!--Sidebar content-->
        <div id="sidebar">

            <div class="shortcuts">
                <ul>
                    <li><a href="#" title="Support section" class="tip"><span class="icon24 wpzoom-support"></span></a></li>
                    <li><a href="#" title="Database backup" class="tip"><span class="icon24 icomoon-icon-database"></span></a></li>
                    <li><a href="#" title="Sales statistics" class="tip"><span class="icon24 iconic-icon-chart"></span></a></li>
                    <li><a href="#" title="Write post" class="tip"><span class="icon24 icomoon-icon-pencil"></span></a></li>
                </ul>
            </div><!-- End search -->            

            <div class="sidenav">

                <div class="sidebar-widget" style="margin: -1px 0 0 0;">
                    <h5 class="title" style="margin-bottom:0">Quản lý</h5>
                </div><!-- End .sidenav-widget -->

                <div class="mainnav">
                    <ul>
                        <li><a href="<?php echo url_for('@sf_guard_user'); ?>"><span class="icon16 entypo-icon-users"></span>Quản lý người dùng</a></li>
                        <li><a href="<?php echo url_for('@jobboard_list'); ?>"><span class="icon16 brocco-icon-home"></span>Quản lý website</a></li>
                        <li><a href="<?php echo url_for('@marque_list'); ?>"><span class="icon16 brocco-icon-apple"></span>Quản lý thương hiệu</a></li>
                        <li><a href="<?php echo url_for('@order_list'); ?>"><span class="icon16 silk-icon-checklist"></span>Quản lý đơn hàng</a></li>
						<li><a href="<?php echo url_for('@category_list'); ?>"><span class="icon16 brocco-icon-address-book"></span>Quản lý danh mục</a></li>
                        <li><a href="<?php echo url_for('@cms_category_list'); ?>"><span class="icon16 icomoon-icon-new"></span>Quản lý tin tức</a></li>
                        <li><a href="<?php echo url_for('@slot_list'); ?>"><span class="icon16 entypo-icon-info-circle"></span>Quản lý Slot</a></li>
                        <li><a href="<?php echo url_for('@information'); ?>"><span class="icon16 entypo-icon-info-circle"></span>Thông tin khác</a></li>
                    </ul>
                </div>
            </div><!-- End sidenav -->

            <div class="sidebar-widget">
                <h5 class="title">Right now</h5>
                <div class="content">
                    <div class="rightnow">
                        <ul class="unstyled">
                            <li><span class="number">34</span><span class="icon16 icomoon-icon-new"></span>Posts</li>
                            <li><span class="number">7</span><span class="icon16 icomoon-icon-paper"></span>Pages</li>
                            <li><span class="number">14</span><span class="icon16 brocco-icon-list"></span>Categories</li>
                            <li><span class="number">201</span><span class="icon16 icomoon-icon-tag"></span>Tags</li>
                        </ul>
                    </div>
                </div>

            </div><!-- End .sidenav-widget -->

        </div><!-- End #sidebar -->

        <!--Body content-->
        <div id="content" class="clearfix">
            <div class="contentwrapper"><!--Content wrapper-->

                <div class="heading">

                    <h3><?php echo $moduleName; ?></h3>                    

                    <div class="resBtnSearch">
                        <a href="#"><span class="icon16 brocco-icon-search"></span></a>
                    </div>

                    <div class="search">

                        <form id="searchform" action="search.html" />
                            <input type="text" id="tipue_search_input" class="top-search" placeholder="Search here ..." />
                            <input type="submit" id="tipue_search_button" class="search-btn" value="" />
                        </form>

                    </div><!-- End search -->

                    <ul class="breadcrumb">
                    	<li>
                            <a href="<?php echo url_for("default") ?>" class="tip" title="back to dashboard">
                                <span class="icon16 icomoon-icon-screen"></span>
                            </a> 
                            <span class="divider">
                                <span class="icon16 icomoon-icon-arrow-right"></span>
                            </span>
                        </li>
                    	<?php
						for ($i = count($breadcrumb)-1; $i >= 0; $i --)
						{
							$link = $breadcrumb[$i];
							if ($i == 0)
							{
							?>
                            	<li class="active"><?php echo $link['name']?></li>
                            <?
							}
							else {
						?>
                        <li>
                        	<a href="<?php echo $link['link']; ?>" class="tip" title="<?php echo $link['name'] ?>">
                                <?php echo $link['name']; ?>
                            </a> 
                            <span class="divider">
                                <span class="icon16 icomoon-icon-arrow-right"></span>
                            </span>
                        </li>
                        <?
							}
						}
						?>
                    </ul>
                </div><!-- End .heading-->
				<?php echo $sf_content; ?>
            </div><!-- End contentwrapper -->
        </div><!-- End #content -->
    
    </div><!-- End #wrapper -->
    
    
  <?php
  }
  ?>
</body>
</html>